<%--
  Created by IntelliJ IDEA.
  User: 全谢民
  Date: 2023/10/1
  Time: 8:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="path" value="${pageContext.request.contextPath }"/>
<html>
<head>
    <title>基本信息</title>
    <%--    左侧样式--%>
    <link rel="stylesheet" type="text/css" href="${path}/css/user_page_css/user.css">
    <%--    头部底部样式--%>
    <link rel="stylesheet" type="text/css" href="${path}/css/user_page_css/home_page.css">
    <%--    右侧样式--%>
    <link rel="stylesheet" type="text/css" href="${path}/css/user_page_css/userProfile.css">
    <%--    导入js--%>
    <script rel="script" type="text/javascript" src="${path}/js/jquery-3.6.4.js"></script>
    <style>
    </style>
</head>
<body>
<%--    前端用户--%>
<%@include file="header.jsp"%>
<div class="content">
    <div class="main">
        <div class="user-profile-nav">
            <h1>个人中心</h1>
            <a class="userBack" onclick="jquery:window.location='userOrderDetail.jsp'">我的订单</a>
            <a class="userBack" onclick="jquery:window.location='userCollection.jsp'">我的收藏</a>
            <a class="userBack" onclick="jquery:window.location='userComments.jsp'">我的评论</a>

<%--            收获地址--%>
            <a class="userBack" onclick="jquery:window.location='userShoppingAddress.jsp'">收货地址</a>
            <a class="userBack" style="background-color: #ef4238" onclick="jquery:window.location='userProfile.jsp'">基本信息</a>
            <a class="userBack" onclick="jquery:window.location='userSetUp.jsp'">账号设置</a>
<%--            登陆方式 /1.手机号验证2.密码 3.邮箱 4.实名认证--%>
            <a class="userBack" onclick="jquery:window.location='userTicketPeople.jsp'">常用购票人</a>
<%--            姓名/证件类型/身份证号--%>
            <a class="userBack" onclick="jQuery:window.location=''">退出登录</a>
        </div>
        <c:set var="user" value="${requestScope.user}"/>
        <c:choose>
            <c:when test="${empty user}">
                <script>
                    window.location='${path}/servlet/userPersona/selUserPersona?userId=1'
                </script>
            </c:when>
            <c:otherwise>
                <div class="profile-container">
                    <div class="profile-title">基本信息</div>
                    <div class="avatar-container">
                        <div class="avatar-content">
                            <img id="userImage" name="userImage" src="${path}/images/userAvatar/${user.userHeader}">
                            <div class="J-upload-avatar-w upload-avatar-image">
                                <input type="button" class="J-upload-avatar upload-btn" value="更换头像">
                            </div>
                        </div>
                        <div class="tips">支持JPG,JPEG,PNG格式,且文件需小于1M</div>
                    </div>
                        <%--            id="fileUpload"--%>
                    <form id="J-userexinfo-form" class="userexinfo-form" enctype="multipart/form-data"  method="post" action="${path}/servlet/userPersona/updUserPersona?userId=1">
                        <input type="file" id="fileUpload" style="opacity: 0;position: absolute;left: 105px;bottom: 259px; font-size: 43px!important;width: 182px;"  name="file" value="${user.userHeader}">
                        <div class="userexinfo-form-section">
                            <p>昵称：</p>
                            <span>
                                <input type="text" name="nickName" id="userexinfo-form-nickname" class="ui-checkbox" placeholder="2-15个字，支持中英文、数字" value="${user.userName}">
                            </span>
                        </div>
                        <div class="userexinfo-form-section">
                            <p>性别：</p>
                            <c:if test="${user.gender==男}">
                                <span><input type="radio" name="gender" class="ui-radio radio-first" value="1" checked>男</span>
                                <span><input type="radio" name="gender" class="ui-radio" value="2">女</span>
                            </c:if>
                            <c:if test="${userAll.gender==女}">
                                <span><input type="radio" name="gender" class="ui-radio " value="1">男</span>
                                <span><input type="radio" name="gender" class="ui-radio radio-first"  value="2" checked>女</span>
                            </c:if>
                        </div>
                        <div class="date-picker userexinfo-form-section ">
                            <p>生日：</p>
                            <span>
                                <input type="date" style="border: white" name="birth" value="${user.birth}" class="ui-birth">
                            </span>
                        </div>
                        <div class="userexinfo-form-section">
                            <p>用户积分：</p>
                            <span>
                                <input type="text" name="userIntegral" readonly value="${user.userIntegral}" class="ui-birth">
                            </span>
                        </div>
                        <div class="userexinfo-form-section expand-list">
                            <p>兴趣爱好：</p>
                            <span>
                                <input type="text" name="interest" value="${user.interest}" placeholder="请输入你的兴趣爱好">
                            </span>
                        </div>
                        <div class="userexinfo-form-section">
                            <P>个性签名：</P>
                            <span>
                                <input type="text" name="signature" value="${user.userIntegral}" placeholder="20个字以内">
                            </span>
                        </div>
                        <div class="userexinfo-bottom-section clearfix">
                            <input  type="submit" class="form-save-btn" value="保存">
                        </div>
                    </form>
                </div>
            </c:otherwise>
        </c:choose>
    </div>
</div>
<%@include file="footer.jsp"%>
<script>
    $("#fileUpload").change(function () {
        //获取文件名称
        var url=document.getElementById('fileUpload').files[0].name;
        $("#userImage").attr("src","${path}/images/userAvatar/"+url);
    })
</script>
</body>
</html>
